package HouseTest.dao;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.PropertyConfigurator;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ThingManage {
    public static SqlSession startThing() throws IOException {
        SqlSession  sqlSession=null;
        InputStream resourceAsStream = Resources.getResourceAsStream("config/mybatis-config.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
        sqlSession = build.openSession();
        return sqlSession;
    }

//    public static void journal() throws IOException {
//        FileInputStream fileInputStream = null;
//        Properties properties = new Properties();
//        fileInputStream = new FileInputStream("src/main/resources/config/log4j.properties");
//        properties.load(fileInputStream);
//        PropertyConfigurator.configure(properties);
//    }
}
